3.159 \(\int (c+d x) (a+b \sin (e+f x))^2 \, dx\)

Optimal. Leaf size=116 \[ \frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \cos (e+f x)}{f}+\frac{2 a b d \sin (e+f x)}{f^2}-\frac{b^2 (c+d x) \sin (e+f x) \cos (e+f x)}{2 f}+\frac{1}{2} b^2 c x+\frac{b^2 d \sin ^2(e+f x)}{4 f^2}+\frac{1}{4} b^2 d x^2 \]

[Out]

(b^2*c*x)/2 + (b^2*d*x^2)/4 + (a^2*(c + d*x)^2)/(2*d) - (2*a*b*(c + d*x)*Cos[e + f*x])/f + (2*a*b*d*Sin[e + f*
x])/f^2 - (b^2*(c + d*x)*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b^2*d*Sin[e + f*x]^2)/(4*f^2)

________________________________________________________________________________________

Rubi [A]  time = 0.0975296, antiderivative size = 116, normalized size of antiderivative = 1., number of steps used = 6, number of rules used = 4, integrand size = 18, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.222, Rules used = {3317, 3296, 2637, 3310} \[ \frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \cos (e+f x)}{f}+\frac{2 a b d \sin (e+f x)}{f^2}-\frac{b^2 (c+d x) \sin (e+f x) \cos (e+f x)}{2 f}+\frac{1}{2} b^2 c x+\frac{b^2 d \sin ^2(e+f x)}{4 f^2}+\frac{1}{4} b^2 d x^2 \]

Antiderivative was successfully verified.

[In]

Int[(c + d*x)*(a + b*Sin[e + f*x])^2,x]

[Out]

(b^2*c*x)/2 + (b^2*d*x^2)/4 + (a^2*(c + d*x)^2)/(2*d) - (2*a*b*(c + d*x)*Cos[e + f*x])/f + (2*a*b*d*Sin[e + f*
x])/f^2 - (b^2*(c + d*x)*Cos[e + f*x]*Sin[e + f*x])/(2*f) + (b^2*d*Sin[e + f*x]^2)/(4*f^2)

Rule 3317

Int[((c_.) + (d_.)*(x_))^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Int[ExpandIntegrand[
(c + d*x)^m, (a + b*Sin[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, m}, x] && IGtQ[n, 0] && (EqQ[n, 1] ||
IGtQ[m, 0] || NeQ[a^2 - b^2, 0])

Rule 3296

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> -Simp[((c + d*x)^m*Cos[e + f*x])/f, x] +
Dist[(d*m)/f, Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 2637

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3310

Int[((c_.) + (d_.)*(x_))*((b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(d*(b*Sin[e + f*x])^n)/(f^2*n
^2), x] + (Dist[(b^2*(n - 1))/n, Int[(c + d*x)*(b*Sin[e + f*x])^(n - 2), x], x] - Simp[(b*(c + d*x)*Cos[e + f*
x]*(b*Sin[e + f*x])^(n - 1))/(f*n), x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n, 1]

Rubi steps

\begin{align*} \int (c+d x) (a+b \sin (e+f x))^2 \, dx &=\int \left (a^2 (c+d x)+2 a b (c+d x) \sin (e+f x)+b^2 (c+d x) \sin ^2(e+f x)\right ) \, dx\\ &=\frac{a^2 (c+d x)^2}{2 d}+(2 a b) \int (c+d x) \sin (e+f x) \, dx+b^2 \int (c+d x) \sin ^2(e+f x) \, dx\\ &=\frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \cos (e+f x)}{f}-\frac{b^2 (c+d x) \cos (e+f x) \sin (e+f x)}{2 f}+\frac{b^2 d \sin ^2(e+f x)}{4 f^2}+\frac{1}{2} b^2 \int (c+d x) \, dx+\frac{(2 a b d) \int \cos (e+f x) \, dx}{f}\\ &=\frac{1}{2} b^2 c x+\frac{1}{4} b^2 d x^2+\frac{a^2 (c+d x)^2}{2 d}-\frac{2 a b (c+d x) \cos (e+f x)}{f}+\frac{2 a b d \sin (e+f x)}{f^2}-\frac{b^2 (c+d x) \cos (e+f x) \sin (e+f x)}{2 f}+\frac{b^2 d \sin ^2(e+f x)}{4 f^2}\\ \end{align*}

Mathematica [A]  time = 0.673374, size = 96, normalized size = 0.83 \[ -\frac{2 \left (2 a^2+b^2\right ) (e+f x) (d (e-f x)-2 c f)+16 a b f (c+d x) \cos (e+f x)-16 a b d \sin (e+f x)+2 b^2 f (c+d x) \sin (2 (e+f x))+b^2 d \cos (2 (e+f x))}{8 f^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(c + d*x)*(a + b*Sin[e + f*x])^2,x]

[Out]

-(2*(2*a^2 + b^2)*(e + f*x)*(-2*c*f + d*(e - f*x)) + 16*a*b*f*(c + d*x)*Cos[e + f*x] + b^2*d*Cos[2*(e + f*x)]
- 16*a*b*d*Sin[e + f*x] + 2*b^2*f*(c + d*x)*Sin[2*(e + f*x)])/(8*f^2)

________________________________________________________________________________________

Maple [B]  time = 0.013, size = 216, normalized size = 1.9 \begin{align*}{\frac{1}{f} \left ({\frac{{a}^{2}d \left ( fx+e \right ) ^{2}}{2\,f}}+{a}^{2}c \left ( fx+e \right ) -{\frac{{a}^{2}de \left ( fx+e \right ) }{f}}+2\,{\frac{abd \left ( \sin \left ( fx+e \right ) - \left ( fx+e \right ) \cos \left ( fx+e \right ) \right ) }{f}}-2\,abc\cos \left ( fx+e \right ) +2\,{\frac{abde\cos \left ( fx+e \right ) }{f}}+{\frac{{b}^{2}d}{f} \left ( \left ( fx+e \right ) \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) -{\frac{ \left ( fx+e \right ) ^{2}}{4}}+{\frac{ \left ( \sin \left ( fx+e \right ) \right ) ^{2}}{4}} \right ) }+{b}^{2}c \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) -{\frac{{b}^{2}de}{f} \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) } \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((d*x+c)*(a+b*sin(f*x+e))^2,x)

[Out]

1/f*(1/2*a^2/f*d*(f*x+e)^2+a^2*c*(f*x+e)-a^2/f*d*e*(f*x+e)+2/f*a*b*d*(sin(f*x+e)-(f*x+e)*cos(f*x+e))-2*a*b*c*c
os(f*x+e)+2/f*a*b*d*e*cos(f*x+e)+1/f*b^2*d*((f*x+e)*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-1/4*(f*x+e)^2+1
/4*sin(f*x+e)^2)+b^2*c*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e)-1/f*b^2*d*e*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*
f*x+1/2*e))

________________________________________________________________________________________

Maxima [A]  time = 0.994603, size = 273, normalized size = 2.35 \begin{align*} \frac{8 \,{\left (f x + e\right )} a^{2} c + 2 \,{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} c + \frac{4 \,{\left (f x + e\right )}^{2} a^{2} d}{f} - \frac{8 \,{\left (f x + e\right )} a^{2} d e}{f} - \frac{2 \,{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} b^{2} d e}{f} - 16 \, a b c \cos \left (f x + e\right ) + \frac{16 \, a b d e \cos \left (f x + e\right )}{f} - \frac{16 \,{\left ({\left (f x + e\right )} \cos \left (f x + e\right ) - \sin \left (f x + e\right )\right )} a b d}{f} + \frac{{\left (2 \,{\left (f x + e\right )}^{2} - 2 \,{\left (f x + e\right )} \sin \left (2 \, f x + 2 \, e\right ) - \cos \left (2 \, f x + 2 \, e\right )\right )} b^{2} d}{f}}{8 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="maxima")

[Out]

1/8*(8*(f*x + e)*a^2*c + 2*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*c + 4*(f*x + e)^2*a^2*d/f - 8*(f*x + e)*a^2*d*
e/f - 2*(2*f*x + 2*e - sin(2*f*x + 2*e))*b^2*d*e/f - 16*a*b*c*cos(f*x + e) + 16*a*b*d*e*cos(f*x + e)/f - 16*((
f*x + e)*cos(f*x + e) - sin(f*x + e))*a*b*d/f + (2*(f*x + e)^2 - 2*(f*x + e)*sin(2*f*x + 2*e) - cos(2*f*x + 2*
e))*b^2*d/f)/f

________________________________________________________________________________________

Fricas [A]  time = 2.03659, size = 252, normalized size = 2.17 \begin{align*} \frac{{\left (2 \, a^{2} + b^{2}\right )} d f^{2} x^{2} + 2 \,{\left (2 \, a^{2} + b^{2}\right )} c f^{2} x - b^{2} d \cos \left (f x + e\right )^{2} - 8 \,{\left (a b d f x + a b c f\right )} \cos \left (f x + e\right ) + 2 \,{\left (4 \, a b d -{\left (b^{2} d f x + b^{2} c f\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{4 \, f^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="fricas")

[Out]

1/4*((2*a^2 + b^2)*d*f^2*x^2 + 2*(2*a^2 + b^2)*c*f^2*x - b^2*d*cos(f*x + e)^2 - 8*(a*b*d*f*x + a*b*c*f)*cos(f*
x + e) + 2*(4*a*b*d - (b^2*d*f*x + b^2*c*f)*cos(f*x + e))*sin(f*x + e))/f^2

________________________________________________________________________________________

Sympy [A]  time = 0.84567, size = 219, normalized size = 1.89 \begin{align*} \begin{cases} a^{2} c x + \frac{a^{2} d x^{2}}{2} - \frac{2 a b c \cos{\left (e + f x \right )}}{f} - \frac{2 a b d x \cos{\left (e + f x \right )}}{f} + \frac{2 a b d \sin{\left (e + f x \right )}}{f^{2}} + \frac{b^{2} c x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{b^{2} c x \cos ^{2}{\left (e + f x \right )}}{2} - \frac{b^{2} c \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} + \frac{b^{2} d x^{2} \sin ^{2}{\left (e + f x \right )}}{4} + \frac{b^{2} d x^{2} \cos ^{2}{\left (e + f x \right )}}{4} - \frac{b^{2} d x \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} - \frac{b^{2} d \cos ^{2}{\left (e + f x \right )}}{4 f^{2}} & \text{for}\: f \neq 0 \\\left (a + b \sin{\left (e \right )}\right )^{2} \left (c x + \frac{d x^{2}}{2}\right ) & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))**2,x)

[Out]

Piecewise((a**2*c*x + a**2*d*x**2/2 - 2*a*b*c*cos(e + f*x)/f - 2*a*b*d*x*cos(e + f*x)/f + 2*a*b*d*sin(e + f*x)
/f**2 + b**2*c*x*sin(e + f*x)**2/2 + b**2*c*x*cos(e + f*x)**2/2 - b**2*c*sin(e + f*x)*cos(e + f*x)/(2*f) + b**
2*d*x**2*sin(e + f*x)**2/4 + b**2*d*x**2*cos(e + f*x)**2/4 - b**2*d*x*sin(e + f*x)*cos(e + f*x)/(2*f) - b**2*d
*cos(e + f*x)**2/(4*f**2), Ne(f, 0)), ((a + b*sin(e))**2*(c*x + d*x**2/2), True))

________________________________________________________________________________________

Giac [A]  time = 1.10087, size = 161, normalized size = 1.39 \begin{align*} \frac{1}{2} \, a^{2} d x^{2} + \frac{1}{4} \, b^{2} d x^{2} + a^{2} c x + \frac{1}{2} \, b^{2} c x - \frac{b^{2} d \cos \left (2 \, f x + 2 \, e\right )}{8 \, f^{2}} + \frac{2 \, a b d \sin \left (f x + e\right )}{f^{2}} - \frac{2 \,{\left (a b d f x + a b c f\right )} \cos \left (f x + e\right )}{f^{2}} - \frac{{\left (b^{2} d f x + b^{2} c f\right )} \sin \left (2 \, f x + 2 \, e\right )}{4 \, f^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((d*x+c)*(a+b*sin(f*x+e))^2,x, algorithm="giac")

[Out]

1/2*a^2*d*x^2 + 1/4*b^2*d*x^2 + a^2*c*x + 1/2*b^2*c*x - 1/8*b^2*d*cos(2*f*x + 2*e)/f^2 + 2*a*b*d*sin(f*x + e)/
f^2 - 2*(a*b*d*f*x + a*b*c*f)*cos(f*x + e)/f^2 - 1/4*(b^2*d*f*x + b^2*c*f)*sin(2*f*x + 2*e)/f^2